package com.wyix;

import com.wyix.config.AppConfig;
import com.wyix.service.impl.OrderService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author wangdx
 * @since 2025/8/6
 */
public class SpringAppTest {
    public static void main(String[] args) {
        // 启动Spring容器
        var context = new AnnotationConfigApplicationContext(AppConfig.class);
        OrderService orderService = context.getBean(OrderService.class);

        // 测试下单功能
        String orderId = orderService.createOrder("user001", "book999");
        System.out.println("生成的订单号：" + orderId);

        // 测试查询功能（正常）
        String detail = orderService.queryOrder(orderId);
        System.out.println(detail);

        // 测试查询功能（异常）
        orderService.queryOrder(null);
    }

}
